package qvanguoobject.test03;

public class Calculation {
    // 加法方法
    public double add(double a, double b) {
        return a + b;
    }

    // 减法方法
    public double sub(double a, double b) {
        return a - b;
    }

    // 乘法方法
    public double times(double a, double b) {
        return a * b;
    }

    // 除法方法
    public double div(double a, double b) {
        if (b == 0) {
            throw new ArithmeticException("除数不能为零");
        }
        return a / b;
    }
}
